health_rank_full <- read_csv('health_county_full_2016.csv')
cols_to_keep <- c('Geo_QNAME', 'Geo_NAME', 'Geo_FIPS', 'ORG_HD2016_001_HEALTH_T6_V25', 'ORG_HD2016_001_HEALTH_T6_V13', 'ORG_HD2016_003_HEALTH_T9_V9', 'ORG_HD2016_006_HEALTH_T3_V42', 'ORG_HD2016_006_HEALTH_T3_V35', 'ORG_HD2016_006_HEALTH_T3_V25')
health_condense <- health_rank_full %>%
select(., all_of(cols_to_keep)) %>%
rename('Total Population' = 'ORG_HD2016_001_HEALTH_T6_V25',
'Percent Population 65 and Above' = 'ORG_HD2016_001_HEALTH_T6_V13',
'Percent Uninsured (Ages 18-64)' = 'ORG_HD2016_003_HEALTH_T9_V9',
'Percent Without Insurance (Under 65)' = 'ORG_HD2016_006_HEALTH_T3_V42',
'Primary Care Physicians per 100K' = 'ORG_HD2016_006_HEALTH_T3_V35',
'Preventable Hospital Stays per 100K Medicare enrollees' = 'ORG_HD2016_006_HEALTH_T3_V25')
health_counties <- merge(counties, health_condense, by = 'Geo_FIPS')
shape_reproj <- set_projection(cases_health_counties, projection = 'longlat')
cty_map <- tm_shape(shape_reproj) +
tm_polygons('Confirmed Cases per 100K', style = 'jenks', popup.vars = c('Geo_NAME', 'Total Population', 'Percent Population 65 and Above', 'Primary Care Physicians per 100K', 'Percent Without Insurance (Under 65)', 'Confirmed Cases', 'Confirmed Cases per 100K')) +
tm_layout(title = "Per Capita COVID-19 Confirmed Cases By County",
title.size = 1,
title.position = c("center", "top"))
# tm_format
cty_map
# tmap_save(cty_map, filename = 'county_map_test_v2.html')
# cty_layers <- tm_shape(shape_reproj) +
# tm_polygons(c('Confirmed Cases per 100K', 'Primary Care Physicians per 100K'),
# style = 'jenks',
# popup.vars = c('Geo_NAME', 'Total Population', 'Percent Population 65 and Above', 'Primary Care Physicians per 100K', 'Percent Without Insurance (Under 65)', 'Confirmed Cases', 'Confirmed Cases per 100K'),
# title = c('Confirmed Cases per 100K', 'Primary Care Physicians per 100K')) +
# tm_facets(as.layers = TRUE)
# # tm_layout(title = "Per Capita COVID-19 Confirmed Cases By County",
# # title.size = 1,
# # title.position = c("center", "top"))
#
# cty_layers